def getBuiltInSlotNamesBot(bot_file):
    builtin_slots = []
    builtin_dict = {}
    for intent in bot_file['bot']['intents']:
        if intent['slots']:
            for slot in intent['slots']:
                if 'AMAZON' in slot['slotType']:
                    if slot['name'] not in builtin_slots:
                        builtin_slots.append(slot['name'])
                        builtin_dict[(slot['name'])] = slot['slotType']

    return builtin_slots, builtin_dict


def getCustomSlotNameValuesBot(bot_file):
    '''gets the custom slotName and the slotValues from the application file'''
    translated_custom_slot_names = []
    intents = bot_file['bot']['intents']
    for intent in intents:
        slots = intent["slots"]
        for slot in slots:
            slottype = slot['slotType']
            name = slot['name']
            translated_custom_slot_names.append([slottype, name])

    custom_slots = []  #(slotValue, slotName) pairings
    custom_name =[]
    custom_values = []
    slot_types = bot_file['bot']['slotTypes']
    for slot in slot_types:
        slot_type_name = (slot['name'])  #name of the slot type
        #print(slot_name)
        #custom_name.append(slot_name)
        for translated_name in translated_custom_slot_names:
            for values in (slot['enumerationValues']):
                if slot_type_name == translated_name[0]:  #[0] represents the slottypeName
                    #print(slot_name,translated_name[0] )
                    custom_name.append(translated_name[1])  #if they share the same slotType, append the Name of the slot
                    slot_value = (values['value'])
                    custom_values.append(slot_value)
                    custom_slots.append((slot_value,translated_name[1]))

    return custom_slots, custom_values, custom_name


def getALLSlotNamesBot(bot_file): #only grabbing names since we are not checking AMAZON.slot's values
    all_slots = []
    for intent in bot_file['bot']['intents']:
        if intent['slots']:
            for names in intent['slots']:
                all_slots.append(names['name'])
    return all_slots


def getApplicationBotName(application_data):
    '''gets the value of the 'name' field in a application file'''
    domain_name_bot = application_data['bot']['name']
    return domain_name_bot